<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns="http://www.w3.org/1999/html">
<head>
    <meta charset="utf-8"/>
    <title>劲松商城后台</title>
    <div th:include="Admin/public/Common::head"></div>
    <script type="text/javascript">
        $(function (){
            $(".shanchu").click(function (){
                var id=$(this).attr("id");
                var pn=$(this).attr("pn");
                swal({
                    title: "确定删除?",
                    text: "删除之后不可撤回哟",
                    icon: "warning",
                    buttons: ["我再想想┭┮﹏┭┮", "确定删除！"],
                    dangerMode: true,
                    showCancelButton: true,
                })
                    .then((willDelete) => {
                        if (willDelete) {
                            $.ajax({
                                url:"http://localhost:8080/admin/deletelog",
                                type:"POST",
                                data: {id:id},
                                success:function (data){
                                    swal("此日志已删除", {icon: "success",}).then(function (){
                                        location.href="http://localhost:8080/admin/log?pn="+pn;
                                    });
                                }
                            })
                        } else {
                            swal("想好了再点哟");
                        }
                    });
            })
        })
    </script>
</head>
<body>
<div class="main-wrap">
    <div th:include="Admin/public/Common::menu"></div>
    <div class="content-wrap">
        <div th:replace="Admin/public/Common::header"></div>
        <main class="main-cont content mCustomScrollbar">
            <div class="page-wrap">
                <!--开始::内容-->
                <section class="page-hd">
                    <header>
                        <h2 class="title">日志管理</h2>
                    </header>
                    <hr>
                </section>
                <table class="table table-bordered table-striped table-hover">
                    <thead>
                    <tr>
                        <th>日志id</th>
                        <th>模块</th>
                        <th>具体操作</th>
                        <th>类名</th>
                        <th>方法名</th>
                        <th>请求参数</th>
                        <th>ip地址</th>
                        <th>用时</th>
                        <th>执行时间</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr class="cen" th:each="log:${pages.list}">
                        <td th:text="${log.id}"></td>
                        <td><a href="#" th:text="${log.moudle}" style="color: #2E9EFE"></a></td>
                        <td th:text="${log.operation}"></td>
                        <td th:text="${log.classname}"></td>
                        <td th:text="${log.methodname}"></td>
                        <td th:text="${log.parms}"></td>
                        <td th:text="${log.ip}"></td>
                        <td th:text="${log.time}+'ms'"></td>
                        <td th:text="${log.Timechange()}"></td>
                        <td>
                            <button  class="btn btn-info-outline radius size-l shanchu" th:id="${log.id}" th:pn="${pages.pageNum}">删除</button>
                        </td>
                    </tr>
                    </tbody>
                </table>
                <!--开始::结束-->
                <center>
                    <ul class="pagination justify-content-center">
                        <li class="page-item"><a href="#" th:href="@{/admin/log(pn=${pages.getPrePage()})}">上一页</a></li>
                        <li class="page-item" th:each="num:${pages.getNavigatepageNums()}">
                            <a th:if="${num==pages.getPageNum()}" href="#" th:text="${num}"
                               th:href="@{/admin/log(pn=${num})}" style="color: blue"></a>
                            <a th:if="${num!=pages.getPageNum()}" href="#" th:text="${num}"
                               th:href="@{/admin/log(pn=${num})}"></a>
                        </li>
                        <li class="page-item"><a href="#" th:href="@{/admin/log(pn=${pages.getNextPage()})}">下一页</a></li><br>
                    </ul>
                    <p th:text="当前+${pages.getPageNum()}+页+','+总共+${pages.getPages()}+页+','+总+${pages.getTotal()}+条记录"></p>
                </center>
            </div>
        </main>
        <div th:replace="Admin/public/Common::footer"></div>
    </div>
</div>
</body>
</html>
